home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_tk80.idb / usr / freeware / include / tk / tkScrollbar.h.z / tkScrollbar.h
Encoding:
C/C++ Source or Header  |  1999-04-16  |  7.2 KB  |  209 lines

  1. /*
  2.  * tkScrollbar.h --
  3.  *
  4.  *    Declarations of types and functions used to implement
  5.  *    the scrollbar widget.
  6.  *
  7.  * Copyright (c) 1996 by Sun Microsystems, Inc.
  8.  *
  9.  * See the file "license.terms" for information on usage and redistribution
  10.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  11.  *
  12.  * RCS: @(#) $Id: tkScrollbar.h,v 1.4 1998/09/14 18:23:17 stanton Exp $
  13.  */
  14.  
  15. #ifndef _TKSCROLLBAR
  16. #define _TKSCROLLBAR
  17.  
  18. #ifndef _TKINT
  19. #include "tkInt.h"
  20. #endif
  21.  
  22. #ifdef BUILD_tk
  23. # undef TCL_STORAGE_CLASS
  24. # define TCL_STORAGE_CLASS DLLEXPORT
  25. #endif
  26.  
  27. /*
  28.  * A data structure of the following type is kept for each scrollbar
  29.  * widget.
  30.  */
  31.  
  32. typedef struct TkScrollbar {
  33.     Tk_Window tkwin;        /* Window that embodies the scrollbar.  NULL
  34.                  * means that the window has been destroyed
  35.                  * but the data structures haven't yet been
  36.                  * cleaned up.*/
  37.     Display *display;        /* Display containing widget.  Used, among
  38.                  * other things, so that resources can be
  39.                  * freed even after tkwin has gone away. */
  40.     Tcl_Interp *interp;        /* Interpreter associated with scrollbar. */
  41.     Tcl_Command widgetCmd;    /* Token for scrollbar's widget command. */
  42.     Tk_Uid orientUid;        /* Orientation for window ("vertical" or
  43.                  * "horizontal"). */
  44.     int vertical;        /* Non-zero means vertical orientation
  45.                  * requested, zero means horizontal. */
  46.     int width;            /* Desired narrow dimension of scrollbar,
  47.                  * in pixels. */
  48.     char *command;        /* Command prefix to use when invoking
  49.                  * scrolling commands.  NULL means don't
  50.                  * invoke commands.  Malloc'ed. */
  51.     int commandSize;        /* Number of non-NULL bytes in command. */
  52.     int repeatDelay;        /* How long to wait before auto-repeating
  53.                  * on scrolling actions (in ms). */
  54.     int repeatInterval;        /* Interval between autorepeats (in ms). */
  55.     int jump;            /* Value of -jump option. */
  56.  
  57.     /*
  58.      * Information used when displaying widget:
  59.      */
  60.  
  61.     int borderWidth;        /* Width of 3-D borders. */
  62.     Tk_3DBorder bgBorder;    /* Used for drawing background (all flat
  63.                  * surfaces except for trough). */
  64.     Tk_3DBorder activeBorder;    /* For drawing backgrounds when active (i.e.
  65.                  * when mouse is positioned over element). */
  66.     XColor *troughColorPtr;    /* Color for drawing trough. */
  67.     int relief;            /* Indicates whether window as a whole is
  68.                  * raised, sunken, or flat. */
  69.     int highlightWidth;        /* Width in pixels of highlight to draw
  70.                  * around widget when it has the focus.
  71.                  * <= 0 means don't draw a highlight. */
  72.     XColor *highlightBgColorPtr;
  73.                 /* Color for drawing traversal highlight
  74.                  * area when highlight is off. */
  75.     XColor *highlightColorPtr;    /* Color for drawing traversal highlight. */
  76.     int inset;            /* Total width of all borders, including
  77.                  * traversal highlight and 3-D border.
  78.                  * Indicates how much interior stuff must
  79.                  * be offset from outside edges to leave
  80.                  * room for borders. */
  81.     int elementBorderWidth;    /* Width of border to draw around elements
  82.                  * inside scrollbar (arrows and slider).
  83.                  * -1 means use borderWidth. */
  84.     int arrowLength;        /* Length of arrows along long dimension of
  85.                  * scrollbar, including space for a small gap
  86.                  * between the arrow and the slider.
  87.                  * Recomputed on window size changes. */
  88.     int sliderFirst;        /* Pixel coordinate of top or left edge
  89.                  * of slider area, including border. */
  90.     int sliderLast;        /* Coordinate of pixel just after bottom
  91.                  * or right edge of slider area, including
  92.                  * border. */
  93.     int activeField;        /* Names field to be displayed in active
  94.                  * colors, such as TOP_ARROW, or 0 for
  95.                  * no field. */
  96.     int activeRelief;        /* Value of -activeRelief option: relief
  97.                  * to use for active element. */
  98.  
  99.     /*
  100.      * Information describing the application related to the scrollbar.
  101.      * This information is provided by the application by invoking the
  102.      * "set" widget command.  This information can now be provided in
  103.      * two ways:  the "old" form (totalUnits, windowUnits, firstUnit,
  104.      * and lastUnit), or the "new" form (firstFraction and lastFraction).
  105.      * FirstFraction and lastFraction will always be valid, but
  106.      * the old-style information is only valid if the NEW_STYLE_COMMANDS
  107.      * flag is 0.
  108.      */
  109.  
  110.     int totalUnits;        /* Total dimension of application, in
  111.                  * units.  Valid only if the NEW_STYLE_COMMANDS
  112.                  * flag isn't set. */
  113.     int windowUnits;        /* Maximum number of units that can be
  114.                  * displayed in the window at once.  Valid
  115.                  * only if the NEW_STYLE_COMMANDS flag isn't
  116.                  * set. */
  117.     int firstUnit;        /* Number of last unit visible in
  118.                  * application's window.  Valid only if the
  119.                  * NEW_STYLE_COMMANDS flag isn't set. */
  120.     int lastUnit;        /* Index of last unit visible in window.
  121.                  * Valid only if the NEW_STYLE_COMMANDS
  122.                  * flag isn't set. */
  123.     double firstFraction;    /* Position of first visible thing in window,
  124.                  * specified as a fraction between 0 and
  125.                  * 1.0. */
  126.     double lastFraction;    /* Position of last visible thing in window,
  127.                  * specified as a fraction between 0 and
  128.                  * 1.0. */
  129.  
  130.     /*
  131.      * Miscellaneous information:
  132.      */
  133.  
  134.     Tk_Cursor cursor;        /* Current cursor for window, or None. */
  135.     char *takeFocus;        /* Value of -takefocus option;  not used in
  136.                  * the C code, but used by keyboard traversal
  137.                  * scripts.  Malloc'ed, but may be NULL. */
  138.     int flags;            /* Various flags;  see below for
  139.                  * definitions. */
  140. } TkScrollbar;
  141.  
  142. /*
  143.  * Legal values for "activeField" field of Scrollbar structures.  These
  144.  * are also the return values from the ScrollbarPosition procedure.
  145.  */
  146.  
  147. #define OUTSIDE        0
  148. #define TOP_ARROW    1
  149. #define TOP_GAP        2
  150. #define SLIDER        3
  151. #define BOTTOM_GAP    4
  152. #define BOTTOM_ARROW    5
  153.  
  154. /*
  155.  * Flag bits for scrollbars:
  156.  * 
  157.  * REDRAW_PENDING:        Non-zero means a DoWhenIdle handler
  158.  *                has already been queued to redraw
  159.  *                this window.
  160.  * NEW_STYLE_COMMANDS:        Non-zero means the new style of commands
  161.  *                should be used to communicate with the
  162.  *                widget:  ".t yview scroll 2 lines", instead
  163.  *                of ".t yview 40", for example.
  164.  * GOT_FOCUS:            Non-zero means this window has the input
  165.  *                focus.
  166.  */
  167.  
  168. #define REDRAW_PENDING        1
  169. #define NEW_STYLE_COMMANDS    2
  170. #define GOT_FOCUS        4
  171.  
  172. /*
  173.  * Declaration of scrollbar class procedures structure.
  174.  */
  175.  
  176. extern TkClassProcs tkpScrollbarProcs;
  177.  
  178. /*
  179.  * Declaration of scrollbar configuration options.
  180.  */
  181.  
  182. extern Tk_ConfigSpec tkpScrollbarConfigSpecs[];
  183.  
  184. /*
  185.  * Declaration of procedures used in the implementation of the scrollbar
  186.  * widget. 
  187.  */
  188.  
  189. EXTERN void        TkScrollbarEventProc _ANSI_ARGS_((
  190.                 ClientData clientData, XEvent *eventPtr));
  191. EXTERN void        TkScrollbarEventuallyRedraw _ANSI_ARGS_((
  192.                 TkScrollbar *scrollPtr));
  193. EXTERN void        TkpComputeScrollbarGeometry _ANSI_ARGS_((
  194.                 TkScrollbar *scrollPtr));
  195. EXTERN TkScrollbar *    TkpCreateScrollbar _ANSI_ARGS_((Tk_Window tkwin));
  196. EXTERN void         TkpDestroyScrollbar _ANSI_ARGS_((
  197.                     TkScrollbar *scrollPtr));
  198. EXTERN void        TkpDisplayScrollbar _ANSI_ARGS_((
  199.                 ClientData clientData));
  200. EXTERN void        TkpConfigureScrollbar _ANSI_ARGS_((
  201.                 TkScrollbar *scrollPtr));
  202. EXTERN int        TkpScrollbarPosition _ANSI_ARGS_((
  203.                 TkScrollbar *scrollPtr, int x, int y));
  204.  
  205. # undef TCL_STORAGE_CLASS
  206. # define TCL_STORAGE_CLASS DLLIMPORT
  207.  
  208. #endif /* _TKSCROLLBAR */
  209.